	<?php
include_once '../common_mbs.inc.php';
include_once '../smarty.inc.php';

//判断访问权限
$admin_index_module_obj = new osgh_admin_index_module_cls();
$is_warrant = $admin_index_module_obj->is_have_warrant($_ADMIN_ID,'consulting_list');
if(!$is_warrant) tcmc_cls::ShowMsg("没有权限访问！", "../index_body.html");

$consulting_obj = new consulting_cls();
$act = trim($_INPUT['action']);
$consulting_id  = $_INPUT['consulting_id'];
if($act =='save')
{	
	$product = $_INPUT['product'];
	$arr = explode('-', $product);	
	
	if(empty($consulting_id)){
		$data = array(
		'product_name'   => $arr[1],
		'product_id' => $arr[0],
		'consulting_addtime'=>time(),
		'add_user'=>$_ADMIN_NAME,
		'status'=>1,
		'consulting_content' => $_INPUT['consulting_content']
		);		
		$consulting_obj->add_consulting($data);
		tcmc_cls::ShowMsg("添加咨询成功！", "consulting_list.php");
	}else{
	  
	   $data = array(
		'product_name'   => $arr[1],
		'product_id' => $arr[0],
		'consulting_addtime'=>time(),
		'add_user'=>$_ADMIN_NAME,
		'consulting_content' => $_INPUT['consulting_content']
		);
	   if(!empty($_INPUT['status'])) $data['status'] = 3;

	   $consulting_obj->update_consulting($data, $consulting_id);
	   tcmc_cls::ShowMsg("修改咨询成功！", "consulting_list.php");
	}
}elseif($act =='del'){
	$consulting_obj->del_consulting($consulting_id);
	tcmc_cls::ShowMsg("删除咨询成功！", "consulting_list.php");
}

?>
